<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class BaseModel extends Model
{
    /**
     * @param array|integer $ids
     * @param array $fields
     * @return mixed
     */
    public static function findByIds($ids, $fields = ['*'])
    {
        $query = static::query();
        if (is_array($ids)) {
            $query->whereIn('id', $ids);
        } else {
            $query->where('id', $ids);
        }
        return $query->select($fields)->get();
    }
}
